package com.cmict.data.infra.recipient;

import com.alibaba.fastjson.JSONArray;
import com.cmict.data.infra.api.emus.NotifyRecipientFilterTypeEnum;
import com.cmict.data.system.api.user.AdminUserApi;
import com.cmict.data.system.api.user.dto.AdminUserRespDTO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Hccake 2020/12/21
 * @version 1.0
 */
@Service
public class AllRecipientFilter implements RecipientFilter {
    @Resource
    private  AdminUserApi adminUserApi;

    /**
     * 当前筛选器对应的筛选类型
     *
     * @return 筛选类型对应的标识
     * @see NotifyRecipientFilterTypeEnum
     */
    @Override
    public Integer filterType() {
        return NotifyRecipientFilterTypeEnum.ALL.getValue();
    }

    /**
     * 接收者筛选
     *
     * @param filterCondition 筛选条件
     * @return 接收者集合
     */
    @Override
    public List<AdminUserRespDTO> filter(List<Long> filterCondition) {
        return adminUserApi.getAllUsers();
    }

    /**
     * 获取当前用户的过滤属性
     *
     * @param sysUser 系统用户
     * @return 该用户所对应筛选条件的属性
     */
    @Override
    public Object getFilterAttr(AdminUserRespDTO sysUser) {
        return null;
    }

    /**
     * 是否匹配当前用户
     *
     * @param filterAttr      筛选属性
     * @param filterCondition 筛选条件
     * @return boolean true: 是否匹配
     */
    @Override
    public boolean match(Object filterAttr, List<Object> filterCondition) {
        return true;
    }

    @Override
    public JSONArray filterInfo(List<Long> filterCondition) {
        return null;
    }

}
